// 封装和文件相关的接口函数
import { request } from "@/utils"

// 1、获取频道列表
export function getChannelApi() {
  return request.get("/channels")
}

// 2、提交文章表单
export function createArticleApi(data) {
  return request.post("/mp/articles?draft=false", data)
}

// 获取文章列表
export function getArticleApi(params) {
  return request.get("/mp/articles", params)
}

// 删除文章
export function deleteArticleApi(articleId) {
  return request.delete(`/mp/articles/${articleId}`)
}

// 获得文章详情
export function getArticleByIdApi(articleId) {
  return request.get(`/mp/articles/${articleId}`)
}

// 更新文章表单
export function updateArticleApi(data) {
  return request.put(`/mp/articles/${data.id}?draft=false`, data)
}